package com.ganzalang.gmall.designpatterns.singleton.lazyload;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;

/**
 * @description: 非线程安全的懒加载单例
 * @author: ganzalang
 */
@Slf4j
public class UnsafeLazyLoadSingleton {

    private static UnsafeLazyLoadSingleton singleton;

    private UnsafeLazyLoadSingleton() {

    }

    public static UnsafeLazyLoadSingleton getInstance() {

        if (singleton == null) {  // 1
            singleton = new UnsafeLazyLoadSingleton(); // 2
        }
        return singleton; // 3
    }

}
